/**
 * Created by Administrator on 2016/8/6.
 */
$(document).ready(function(){

    var timer=setTimeout(function(){
        $('.advertising').animate({height:'0',opacity:'0'},2000);
    },3000);

    /*advertising*/
    $('.close-ad').click(function(){
         clearTimeout(timer);
        $('.advertising').animate({height:'0',opacity:'0'},2000);
    });

    var $ads_li = $('.ads-ul li');
    var $on = $('.ads-ul .on');
    var $buildBand=$('.build-band');
    $ads_li.mouseover(function(){
        var $this = $(this);
        var $n = $this.index();
        $on.removeClass('active');
        $buildBand.removeClass('active');
        $on.eq($n).addClass('active');
        $buildBand.eq($n).addClass('active');
    });

    /*bottom*/
    $('.close-contact').click(function(){
        $('.close-contact').fadeOut(1000);
        $('.bottom').animate({width:'30px'},2000,function(){
            $('.bottom .wrap').hide();
            $('.open-contact').fadeIn(1000);
        });
    });
    $('.open-contact').click(function(){
        $('.open-contact').fadeOut(1000);
        $('.bottom .wrap').show();
        $('.bottom').animate({width:'100%'},2000,function(){
            $('.close-contact').fadeIn(1000);
        });
    });

    /*display-layer*/
    $(".submit-input").click(function(){
        $(".display-layer").css("display","block");
        var brandName=$("#band-input").val();
        $(".specific-band").val(brandName);
    });

    $(".search-at-once").click(function(){
        $(".display-layer").css("display","block");
        var brandName=$("#band-input").val();
        $(".specific-band").val(brandName);
    });

    $(".close").click(function(){
        $(".display-layer").css("display","none");
    });

    $('.tele-num').blur(function(){
        if($('.tele-num').val()==""){
            $('.hint').show();
        }else{
            $('.hint').hide();
        }
    });

    $('.tele-num').focus(function(){
        $('.hint').hide();
    });

    $('.details-part .btn_submit').click(function(){
        if($('.tele-num').val()==""){
            $('.hint').show();
            event.preventDefault();
        }else{
            return;
        }
    });
});